const webpack = require('webpack');
const path = require('path');
const baseConfig = require('./base');

const vendors = [
  'react',
  'react-dom',
  'react-bootstrap',
  // ...其它库
];

module.exports = {
  output: {
    path: path.join(baseConfig.dir.distPath, './assets'), // 配置lib.js的位置
    filename: '[name].dll.js',
    library: '[name]',
  },
  entry: {
    lib: vendors,
  },
  plugins: [
    new webpack.DllPlugin({
      path: 'manifest.json', // 本Dll文件中各模块的索引，供DllReferencePlugin读取使用
      name: '[name]',
      context: __dirname,
    }),
    new webpack.ProvidePlugin({
      // Vue: 'vue'
      React: 'react',
      ReactDOM: 'react-dom',
      ReactBootstrap: 'react-bootstrap',
    }),
  ],
};
